# Author:Li
from django.conf.urls import url
# 当页面可以直接渲染时不需要写视图时候引入TemplateView
from django.views.generic import TemplateView
from django.contrib.auth.decorators import login_required

from apps.users.views import UserInfoView, UploadImageView, ChangePwdView, ChangeMobileView, MyCourseView, MyFavOrgView, \
    MyFavTeacherView, MyFavCourseView, MessageView

urlpatterns = [
    # 课程列表
    url(r'^info/$', UserInfoView.as_view(), name="info"),
    # 头像上传
    url(r'^image/upload/$', UploadImageView.as_view(), name="upload"),
    url(r'^update/pwd/$', ChangePwdView.as_view(), name="update_pwd"),
    url(r'^update/mobile/$', ChangeMobileView.as_view(), name="update_mobile"),
    # url(r'^mycourse/$', MyCourseView.as_view(), name="mycourse"),
    url(r'^mycourse/$', login_required(TemplateView.as_view(template_name="usercenter-mycourse.html"),
                                       login_url='/login/'), {"current_page": "mycourse"}, name="mycourse"),
    # 传递变量值放在url第三个参数中， login_required作为装饰器进行登录校验
    url(r'^myfavorg/$', MyFavOrgView.as_view(), name="myfavorg"),
    url(r'^myfavteacher/$', MyFavTeacherView.as_view(), name="myfavteacher"),
    url(r'^myfavcourse/$', MyFavCourseView.as_view(), name="myfavcourse"),
    url(r'^messages/$', MessageView.as_view(), name="messages"),

]
